package com.snopy.designPattern.chainOfResponsibility;

import com.snopy.designPattern.chainOfResponsibility.impl.DebugLogger;
import com.snopy.designPattern.chainOfResponsibility.impl.ErrorLogger;
import com.snopy.designPattern.chainOfResponsibility.impl.InfoLogger;
import com.snopy.designPattern.chainOfResponsibility.inter.AbstractLogger;
import lombok.extern.slf4j.Slf4j;

/**
 * @author snopy
 * @version 1.0.0
 * @classname Demo
 * @description
 * @email 77912204@qq.com
 * @date 2022/03/03 22:56
 */
@Slf4j
public class Demo {
    private static AbstractLogger chainLogger(){
        AbstractLogger info = new InfoLogger(1);
        AbstractLogger debug = new DebugLogger(2);
        AbstractLogger error = new ErrorLogger(3);
        error.setNext(debug);
        debug.setNext(info);
        return error;
    }
    public static void main(String[] args) {
        AbstractLogger abstractLogger = chainLogger();
        abstractLogger.logMessage(1,"test");
        //abstractLogger.logMessage(2,"test");
        //abstractLogger.logMessage(3,"test");
    }
}
